<!DOCTYPE html>
<html style="height: 100%">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8">
        <title>出库单打印</title>
        <link rel="shortcut icon" href="/web/static/src/img/favicon.ico" type="image/x-icon">
        <link rel="stylesheet" href="/web/static/src/css/full.css">
        <link rel="stylesheet" href="/web/static/lib/fontawesome/css/font-awesome.css">
        <link rel="stylesheet" href="/web/static/lib/bootstrap/css/bootstrap.css">
        <link rel="stylesheet" href="/web/static/src/css/base.css">

        <script language="javascript" src="/lodop/static/lib/lodop6/LodopFuncs.js"></script>
        <script language="javascript" src="/lodop/static/src/js/mathlibrary.js"></script>

        <style type="text/css" id="style">
            body{padding: 10px; font-size: 10pt}

            @media print
            {
                .print-hide {display:none}
            }

            .td_inline {
                display:block;
                overflow:hidden;
                white-space:nowrap;
                text-overflow:ellipsis;
                width: 370pt;
            }

            .nowrap{
                white-space:nowrap;
            }
            /*.table td.noborder{*/
            /*border-top: 0px;*/
            /*}*/

            .table thead tr td{font-weight: bold; font-size: 11pt}

            h4{margin: 0px;  padding: 0px;font-size: 14pt}

            h5{
                font-size:11pt; font-family:'黑体'; font-weight: bold; margin: 0px;  padding: 0px;
            }

            div{font-size: 10pt}

            span.foot_sign{border-bottom: 1px solid #ddd}

            .table tbody tr td{border-top: 1px solid #ddd;}
            .table tbody tr:last-child td{border-top: 1px solid #fff; padding: 0px}
            .table tbody tr.memo td {padding:0px; border-top:0px}

            td{font-size:10pt}

            .font-middle{
                font-size: 12pt;
            }


            .page_head{
                padding-bottom: 20px;
            }

            .underline{text-decoration: underline;}
        </style>
    </head>

    <body>
    <object  id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width=0 height=0>
        <embed id="LODOP_EM" type="application/x-print-lodop" width=0 height=0></embed>
    </object>

    <!-- lodop 控制脚本 -->
    <div class="controls controls-row print-hide">
        <script>
            function CheckIsInstall() {
                try{
                    window.LODOP = getLodop(document.getElementById('LODOP_OB'),document.getElementById('LODOP_EM'));
                    //if ((LODOP!=null)&&(typeof(LODOP.VERSION)!="undefined")) alert("本机已成功安装过Lodop控件!\n  版本号:"+LODOP.VERSION);
                    return true;
                }catch(err){
                    //alert("Error:本机打印控件未安装或需要升级!");
                }
            };
            //CheckIsInstall();

            function print_preview(){
                if (!LODOP.VERSION) return;
                LODOP.PRINT_INIT("出货单");
                LODOP.SET_PRINT_PAGESIZE(0, 2110, 1400, "2410x1400");

                var strStyle = "<style>" + document.getElementById("style").innerHTML + "</style>";
                LODOP.ADD_PRINT_TABLE(100,"10","100%",380,strStyle + document.getElementById("div-body").innerHTML);
                LODOP.SET_PRINT_STYLEA(0,"Vorient",3);
                LODOP.ADD_PRINT_HTM(0,"10","100%",109, strStyle + document.getElementById("div-header").innerHTML);
                LODOP.SET_PRINT_STYLEA(0,"ItemType",1);
                LODOP.SET_PRINT_STYLEA(0,"LinkedItem",1);

                LODOP.ADD_PRINT_HTM(300,10,"90%",140, strStyle + document.getElementById("div-foot").innerHTML);
                LODOP.SET_PRINT_STYLEA(0,"ItemType",1);
                LODOP.SET_PRINT_STYLEA(0,"FontSize",9)
                LODOP.ADD_PRINT_TEXT(475,690,135,20,"第#页/共&页");
                LODOP.SET_PRINT_STYLEA(0,"ItemType",2);
                //LODOP.SET_PRINT_STYLEA(0,"LinkedItem",1);
                //LODOP.ADD_PRINT_BARCODE(32,600,160,18,"EAN128C","${orderId}");
                LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);

                LODOP.PREVIEW();

            }


        </script>

        <a href="javascript:if (CheckIsInstall()){print_preview()}" class="btn btn-primary">联单打印预览</a>
        注: 点击按钮打印出库联单，打印A4纸按Ctrl+P键，或者菜单上面选择文件->打印，文件->页面设置里面可以去除页眉页脚

    </div>

    <!-- 出库单据表头 -->
    <div id="div-header">
        <table border="0" cellSpacing="0" cellPadding="0" width="100%">
            <tbody>
                <tr>
                    <td align="center">
                        <h4 class="page_head">{{ order.company_id.name}}{% if picking.picking_type_code=='incoming' %}入库单{% else %}出货单 {% endif %}</h4>
                    </td>
                </tr>
				{% if picking.picking_type_code!='incoming' %}
                <tr>
                    <td>
                        客户:<span style="font-size: 11pt">
                        {% if order.partner_id.is_company %}
                            {{ order.partner_id.name|default('', True) }}
                        {% else %}
                            {{ order.partner_id.parent_id.name|default('', True) }}
                        {% endif %}
                    </span>
                    </td>
                </tr>
                <tr>
					
                    <td>收货地址:
						{% if picking.sale_id.province_id %}
						{{picking.sale_id.province_id.name}}
						{% endif %}
						 &nbsp;
						{% if picking.sale_id.city_id %}
						{{picking.sale_id.city_id.city_name}}
						{% endif %}
						 &nbsp;
						{% if picking.sale_id.country_id %}
						{{picking.sale_id.country_id.county_name}}
						{% endif %}
						 &nbsp;
							{% if picking.sale_id.street %}
						{{picking.sale_id.street}} 
						{% endif %}
                        &nbsp;&nbsp;
						收货人:&nbsp;{{picking.sale_id.consignee}}
						 {% if picking.sale_id.phone %}
                        联系电话:{{ picking.sale_id.phone|default('', True)}}
						  {% endif %}
                        {% if picking.sale_id.mobile %}
                            &nbsp;&nbsp; 
                            手机:{{ picking.sale_id.mobile|default('', True) }}
                        {% endif %}

                    </td>
					{% endif %}
                </tr>
            </tbody>
        </table>
    </div>

    <!-- 出库单据表身 -->
    <div id="div-body">
        <table class="table table-striped" width="100%">
            <thead>
            <tr>
                <td width="55">序号</td>
                <td class="nowrap" style="text-align: left;">产品名称</td>
                <td class="nowrap"></td>
                <td class="nowrap"></td>
                <td class="nowrap" style="text-align: left;">数量</td>
                <td class="nowrap"></td>
                <td class="nowrap"></td>
                <td class="nowrap" style="text-align: left;">产品说明</td>

            </tr>
            </thead>
            <tbody>
            {% for line in picking.move_lines %}
            <tr>
                <td>{{loop.index}}</td>
                <td colspan="4" style="text-align: left;">
                    <span>{{ line.product_id.name|default('', True) }}</span>
                </td>
                <td colspan="2" style="text-align: left;">{{ line.product_uom_qty| int() }}{% if line.product_id.is_card %}(张) {% else %}(件){% endif %}</td>
                <td style="text-align: left;">{{ line.product_id.description|default('', True) }}</td>
            </tr>
				{% for order_card in picking.order_card_id %}
						{% if order_card.product_id.name==line.product_id.name %}
						<tr>
							<td></td>
							<td style="text-align: left;" colspan="3">
							券号:{{order_card.starting_number.code}}{% if order_card.continue_number!=1 %}~{{order_card.ending_number}}数量{{order_card.continue_number}}{% else %}数量{{order_card.continue_number}}{% endif %}
							</td>
                            <td style="text-align: left;"></td>
                            <td style="text-align: left;"></td>
                            <td style="text-align: left;"></td>
                            
							<td style="text-align: left;"> </td>
					              
						</tr>
						{% endif %} 
				{% endfor %}

            {% endfor %}

            <tr>
                <td colspan="8" style="text-align: left;border-top: 1px solid #ddd;">
                   备注：
                </td>
            </tr>
            {% if order.note %}
                {% for line in order.note.split('\n') %}
            <tr class="memo">
                <td colspan="8">
                    {{ line }}
                </td>
            </tr>
                {% endfor %}
            {% endif %}
            </tbody>
        </table>
    </div>

    <!-- 出库单据表尾 -->
    <div id="div-foot">
        <table width="100%" border="0">
            <tr>    
                <td>货运单号：{{ picking.carrier_tracking_ref|default('', True)}}</td>
            </tr>
            <tr>
                <td>重量：</td>
                <td>体积：</td>
                <td>件数：   件</td>
            </tr>
            <tr>
                <td>实际发货日期：
                  
                </td>
                <td colspan="2">预计到货日期：</td>
            </tr>
            <tr>
                <td>付款方式：
                </td>
                <td>
                    寄付元
                    {% if order.freight_type == 'freight_paid' %}
                        :￥{{picking.freight|default('0.00', True)}}  元
                    <script>
                        document.write("  ("+cmycurd({{picking.freight}})+")");
                    </script>
                    {% endif %}
                </td>
                <td>
                    到付元
                    {% if order.freight_type == 'freight_collect' %}
                        :￥{{picking.freight|default('0.00', True)}}  元
                    <script>
                        document.write("  ("+cmycurd({{picking.freight}})+")");
                    </script>
                    {% endif %}
                </td>
            </tr>
            <tr>
                <td>送货方式：</td>
				<td></td>
            </tr>
            <tr>
                <td>托运方签字：</td>
                <td colspan="2">承运方签字：</td>
            </tr>
            <tr>
                <td colspan="3">收货方签字及意见：</td>
            </tr>
        </table>
    </div>

    </body>
</html>
